package com.example.question.array;

public class Code05_283 {
    public static void main(String[] args) {
        Code05_283 code = new Code05_283();
        code.moveZeroes(new int[]{0, 1, 0});
    }

    // 0 1 0
    public void moveZeroes(int[] nums) {
        int index = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0) {
                nums[index++] = nums[i];
            }
        }
        for (int i = index; i < nums.length; i++) {
            nums[i] = 0;
        }
    }

}
